Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This includes changes to adjust how URLs are generated when performing redirects so that the URLs generated are correct when the application is hosted at a URL.
For URL generation, the change is to swap from hard coded absolute URL paths, to calculating the URL path from the controller/action specified for the route, which is the recommended practice anyway. This is needed in the redirects in the controllers, but also where generating the URL path for embedding images.
To allow hosting at a sub URL a Rack middleware is also required to fix up the Rack request environment so that the Rails application is able to work when it is mounted at a sub URL. This is needed specifically because Rack is used to wrap Rails and is in addition to setting various Rails environment variables.
To host at a sub URL, one would set the environment variables:
cc @jorgemoralespou